<?php



$nav = selectAll('newscate','pid=20');
$cate = empty($_GET['cate'])?21:$_GET['cate'];
$newscate = selectOne('newscate',"Id=$cate");
//$cate_name = $newscate['name'];
//selectAll($table,$where=1,$field='*',$order = 'order by Id desc',$limit='')
$count = selectAll('news',"cate='$cate'",'count(*)')[0]['count(*)'];
//print_r($count);
//die;
$totolpage = ceil($count/5);
$page = empty($_GET['page'])?1:$_GET['page'];
$pages = ($page-1)*3;
$limit = " limit $pages,5";
//selectLimit($table,$field='*',$where=1,$limit='')
$news = selectLimit('news','*',"cate='$cate' order by time desc",$limit);
if(!empty($_GET['search']))
{
	$newstitle = $_GET['search'];
//	print_r($_GET['search']);
//die;
	$news = selectLimit('news','*',"title='$newstitle' order by time desc",$limit);

}

$banner = selectone('banner',"name='news_banner'");
include('app/index/news/html/news.html');
?>